package com.tsit.study.netty.server;

import com.tsit.study.netty.server.server.NettyServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author wangxuzhi
 * @date 2020/11/24 15:19
 */
@Slf4j
@SpringBootApplication
public class NettyServerApplication implements CommandLineRunner {

    @Autowired
    private NettyServer nettyServer;

    public static void main(String[] args) {
        SpringApplication.run(NettyServerApplication.class, args);
    }


    @Override
    public void run(String... args) {
        log.info("netty server start 。。。。。。");
        new Thread(() -> {
            try {
                nettyServer.start();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();
    }
}
